<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>flex-basis设置50px，调整第一个子项的效果</title>
  <style>
    * {
      margin: 0;
      padding: 0;
    }
    .main {
      width: 600px;
      margin: 0 auto;
      border: 1px solid #000;
    }
    .flex-wrapper {
      display: flex;
      height: 500px;
    }
    .item {
      flex-basis: 50px;
      background: #ccc;
      padding: 10px;
      border: 1px solid #000;
    }
    .item1 {
      background: red;
    }
  </style>
</head>
<body>
  <div class="main">
    <div class="flex-wrapper">
      <div class="item item1">11111</div>
      <div class="item">22222</div>
      <div class="item">33333</div>
      <div class="item">44444</div>
    </div>
    
  </div>
  <form action="" class="main">
    <label for="radio1">
      <input type="radio" id="radio1" name="radio" value="row">row行、横
    </label>
    <label for="radio2" style="margin-left: 20px">
      <input type="radio" id="radio2" name="radio" value="column">column列、竖
    </label>
    <div>
      <label for="range">
        <input id="range" type="range" min="0" max="500" value="10">
        <span id="rangeValue">50</span>
      </label>
    </div>
  </form>
  <script>
    window.onload = function () {
      var flexWrapper = document.querySelector('.flex-wrapper');
      var item1 = document.querySelector('.item1');
      var radio1 = document.querySelector('#radio1');
      var radio2 = document.querySelector('#radio2');
      var range = document.querySelector('#range');
      var rangeValue = document.querySelector('#rangeValue');
      radio1.addEventListener('change', function () {
        flexWrapper.style.flexDirection = this.value;
      })
      radio2.addEventListener('change', function () {
        flexWrapper.style.flexDirection = this.value;
      })
      range.addEventListener('input', function () {
        item1.style.flexBasis = this.value + 'px';
        item1.style.width = this.value + 'px';
        rangeValue.innerHTML = this.value;
      })
    }
  </script>
</body>
</html>